package com.egrand.sweetapi.plugin.db;

import com.egrand.sweetapi.plugin.db.service.EgdTenantDataSourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @author starBlues
 * @version 1.0
 */
@Component
public class DbAdapterApplicationListener implements ApplicationListener<ApplicationReadyEvent> {

    @Autowired
    private EgdTenantDataSourceService egdTenantDataSourceService;

    @Override
    public void onApplicationEvent(ApplicationReadyEvent event) {
        this.egdTenantDataSourceService.schedule();
    }
}
